import serial
import pandas as pd
import matplotlib.pyplot as plt

# 测试串口连接
try:
    ser = serial.Serial('COM1', 38400, timeout=1)
    print(f"串口连接成功: {ser.port}")
    ser.close()
except Exception as e:
    print(f"串口连接失败: {e}")

# 测试pandas和matplotlib
df = pd.DataFrame({'x': [1, 2, 3, 4, 5], 'y': [2, 4, 6, 8, 10]})
plt.plot(df['x'], df['y'])
plt.title('测试图表')
plt.xlabel('X轴')
plt.ylabel('Y轴')
plt.show()